package com.ccloud.im.handler;

import com.ccloud.common.im.handler.AuthorizationHandler;
import com.ccloud.common.im.model.CIMMsg;
import com.ccloud.common.im.model.CIMSession;
import com.ccloud.im.service.IUserSessionService;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * cim自定义认证处理器
 *
 * @author scylla
 * @version V1.0
 * @project ccloud-parent
 * @title cim自定义认证处理器
 * @package com.ccloud.im.handler
 * @since 2022/8/2 3:35 下午
 */
@Primary
@Component
public class CustomAuthHandler extends AuthorizationHandler {

    @Resource
    private IUserSessionService userSessionService;

    @Override
    public void process(CIMSession newSession, CIMMsg cimMsg) {
        super.process(newSession, cimMsg);

        //入库用户信息
        userSessionService.save(newSession);
    }
}
